const { DataTypes } = require("sequelize");

const seq = require("../db/seq");

//! 创建模型 ( Model sh_admin --> sh_admins ) 默认会添加s
const Collect = seq.define(
  "sh_collect",
  {
    //? id字段自增，所以会被sequelize自动维护

    user_id: {
      type: DataTypes.INTEGER,
      allowNull: false,
      unique: false,
      comment: "用户的id",
    },

    collect_topic_id: {
      type: DataTypes.INTEGER,
      allowNull: false,
      unique: false,
      comment: "用户收藏的帖子的id",
    },
  },
  {
    tableName: "sh_collects", //todo 直接提供表名
    //* timestamps: false,  //?让seq不会自动创建createdAt 和 updatedAt
  }
);

//!强制同步数据库(创建数据表)
/* Collect.sync({
  force: true, //? 将创建表, 如果表已经存在, 则将其首先删除
}); */

module.exports = Collect;
